package demo6;

import java.time.LocalDate;

//获取某年的父亲节和母亲节的日期
//父亲节6月的第3个星期天

public class Festival01 {
    public static void main(String[] args) {
        System.out.println(getFatherDay(2021));//6-20
        System.out.println(getFatherDay(2020));//6-21
    }
    public static LocalDate getFatherDay(int year) {
        LocalDate d = LocalDate.of(year, 6, 1);
        int count=0;
        do {
            if(d.getDayOfWeek().getValue()==7) {
                count++;
            }
            d = d.plusDays(1);
        }while(count<3);
        return d;
    }
}
